package erfgame.core.world;

import erfgame.core.Rectangle3D;

public class WorldUpdateDescription {
	public static final int FLAG_TERRAIN_SHAPE_CHANGE = 1;
	public static final int FLAG_TERRAIN_APPEARANCE_CHANGE = 2;
	public static final int FLAG_ENTITY_ADDED = 4;
	
	private Rectangle3D area;
	private int flags;
	
	public WorldUpdateDescription( Rectangle3D area, int flags ) {
		this.area = area;
		this.flags = flags;
	}
	
	public boolean isSuperset( WorldUpdateDescription description ) {
		return this.area.contains( description.area ) && (this.flags | description.flags) == this.flags;
	}
	
	public void merge( WorldUpdateDescription description ) {
		this.area.merge( description.area );
		this.flags = this.flags | description.flags;
	}
	
	public Rectangle3D getArea() {
		return this.area;
	}
	
	public int getFlags() {
		return this.flags;
	}
	
}
